package com.jxd.ordersys.service.impl;

import com.jxd.ordersys.dao.EmpMapper;
import com.jxd.ordersys.model.Emp;
import com.jxd.ordersys.service.IEmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @ClassName EmpServiceImpl
 * @Description TODO
 * @Author 王云超
 * @Date 2024/9/19 16:46
 * @Version 1.0
 */
@Service
public class EmpServiceImpl implements IEmpService {

    @Autowired
    EmpMapper empMapper;
    @Override
    public Map<String, Object> selectByPage(String page, String limit, String empName, String deptId) {
        return empMapper.selectByPage(page,limit,empName,deptId);
    }

    @Override
    public List<Emp> getEmpNotOrder(int deptId) {
        return empMapper.getEmpNotOrder(deptId);
    }

    @Override
    public Emp getEmpById(int empId) {
        return empMapper.getEmpById(empId);
    }

    @Override
    public boolean addEmp(Emp emp) {
        return empMapper.addEmp(emp) > 0;
    }

    @Override
    public boolean editEmp(Emp emp) {
        return empMapper.editEmp(emp) > 0;
    }

    @Override
    public boolean delEmpByIds(List<Integer> empIds) {
        return empMapper.delEmp(empIds) >0;
    }

    @Override
    public List<Map<String, Object>> getEmpByPage(Integer page, Integer limit, String empName, Integer deptId) {
        int offset = (page - 1) * limit;
        return empMapper.getEmpByPage(offset,limit,empName,deptId);
    }

    @Override
    public int getEmpCount(String empName, Integer deptId) {
        return empMapper.getEmpCount(empName,deptId);
    }
}